/*
*编写类似openfile的程序打开文件用于输出
*/
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
using namespace std;
 
ofstream & openfile(ofstream &out,const string &fileName)
{
	out.close();
	out.clear();
	out.open(fileName.c_str());
	return out;
}

int main()
{
	ofstream ofs;
	string str = "E:\\config.txt";
	openfile(ofs, str);
	ofs << "aaaaaaaaa" << endl;
	ofs.close();
	system("pause");
	return 0;
}
